import vix from '@bairong/vix'
import Layout from '@V/layout/Layout.vue'
import AUTH_CODE from '@libs/data/const'
import polocyRoute from './modules/policy'

const { routerMap } = vix

routerMap.moduleMap = [
  { id: 'aiMarketing2', title: '首页', code: 'aiHelios' },
  { id: 'aiMarketing', title: '智能决策', code: 'aiHelios' },
  { id: 'aiMarketing3', title: '管理专区', code: 'aiHelios' }
];

(routerMap.routes as any) = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@V/login/Login.vue'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    name: 'home',
    hidden: true,
    module: 'aiMarketing',
    redirect: '/marketing/fieldList',
    props: {
      showSideMenu: true,
      showTabNav: false,
      showBreadcrumb: false,
      contentClass: 'vix-config-content'
    },
    children: [
      {
        path: '404',
        name: 'error404',
        component: () => import('@V/errorPage/404.vue'),
        hidden: true
      }
    ]
  },
  polocyRoute,
  {
    path: '/author',
    name: 'author',
    component: Layout,
    meta: { title: '权限管理', icon: 'set' },
    module: 'aiMarketing',
    props: {
      showSideMenu: true,
      showTabNav: false,
      contentClass: 'vix-config-content'
    },
    icon: 'br aic-icon aic-auth',
    children: [
      {
        path: 'user',
        name: 'userManage',
        component: () => import('@V/author/UserManage.vue'),
        meta: { title: '用户管理', code: 'm.author.user' }
      },
      {
        path: 'department',
        name: 'departmentManage',
        component: () => import('@V/author/DepartmentManage.vue'),
        meta: { title: '部门管理', code: 'm.author.department' }
      },
      {
        path: 'role',
        name: 'roleManage',
        component: () => import('@V/author/RoleManage.vue'),
        meta: { title: '角色管理', code: 'm.author.role' }
      },
      {
        path: 'auth',
        name: 'authManage',
        component: () => import('@V/author/AuthManage.vue'),
        meta: { title: '权限管理', code: 'm.author' }
      }
    ]
  },
  {
    path: '/marketing',
    name: 'aiMarketing',
    component: Layout,
    module: 'aiMarketing',
    props: {
      showSideMenu: true,
      showTabNav: false,
      contentClass: 'vix-config-content'
    },
    meta: { title: '配置中心', icon: 'config', code: AUTH_CODE.CONFIG_CENTER },
    redirect: '/marketing/fieldList',
    children: [
      {
        path: 'fieldList',
        name: 'fieldList',
        meta: { title: '字段模板管理', code: AUTH_CODE.FIELD_MANAGE },
        component: () => import('@V/config/field/FieldList.vue')
      },
      {
        path: 'fieldDetail',
        name: 'fieldDetail',
        meta: { title: '字段模板详情', active: 'fieldList', code: AUTH_CODE.FIELD_VIEW },
        hidden: true,
        component: () => import('@V/config/field/FieldDetail.vue')
      },
      {
        path: 'fieldAdd',
        name: 'fieldAdd',
        meta: { title: '新增字段模板', active: 'fieldList', code: AUTH_CODE.FIELD_ADD },
        hidden: true,
        component: () => import('@V/config/field/FieldEdit.vue')
      },
      {
        path: 'fieldEdit',
        name: 'fieldEdit',
        meta: { title: '编辑字段模板', active: 'fieldList', code: AUTH_CODE.FIELD_EDIT },
        hidden: true,
        component: () => import('@V/config/field/FieldEdit.vue')
      },
      {
        path: 'fieldCopy',
        name: 'fieldCopy',
        meta: { title: '复制字段模板', active: 'fieldList', code: AUTH_CODE.FIELD_COPY },
        hidden: true,
        component: () => import('@V/config/field/FieldEdit.vue')
      },
      {
        path: 'messageList',
        name: 'messageList',
        meta: { title: '短信任务模板', code: AUTH_CODE.MESSAGE_MANAGE },
        component: () => import('@V/config/message/MessageList.vue')
      }
    ]
  }
]
